<?php
/**
 * main model 文件
 * @author Cuil lntschampion@163.com 
 * @date 2016-02-15
 */
class M_log_login extends MY_Model {
	
	public $table = "bjnz_new_admin_log_login";
	function M_log_login() {
		parent::__construct ();
	}
	
	/**
	 * 插入登录日志
	 */	
	function write($userId,$userName,$state,$reason=""){
		
		$arr = array(
			'user_id'=>$userId,
			'user_name'=>$userName,
			'login_time'=>time(),
			'login_ip'=>ip2long(get_client_ip()),
			'state'=>$state,
			'reason'=>$reason
		);
		$this->insert_one($this->table,$arr);		
	}
}